package com.intel.two.listener.building;

import ch.qos.logback.core.db.dialect.DBUtil;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.intel.two.bo.building.RegisterBo;
import com.intel.two.pojo.building.Register;
import com.intel.two.service.building.RegisterService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope("prototype")
public class WebRegisterBoListener extends AnalysisEventListener<RegisterBo> {
    @Autowired
    private RegisterService registerService;
    @Override
    public void invoke(RegisterBo data, AnalysisContext context) {
        Register register = new Register();

        BeanUtils.copyProperties(data,register);

        registerService.addRegister(register);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {

    }
}
